import request from '@/utils/request'

// 查询mx订单列表
export function listOrder(query) {
  return request({
    url: '/jd/order/pageList',
    method: 'get',
    params: query
  })
}// 查询mx历史订单列表
export function listHisOrder(query) {
  return request({
    url: '/jd/order/his/list',
    method: 'get',
    params: query
  })
}

//根据用户查询订单
export function getOrderListByUser(query) {
  return request({
    url: '/jd/order/getOrderList',
    method: 'get',
    params: query
  })
}
//获取当前订单最新登陆状态
export function updateOrderLoginStatus(query) {
  return request({
    url: '/jd/order/updateOrderLoginStatus',
    method: 'post',
    data: query
  })
}
// 查询mx订单详细
export function getOrder(id) {
  return request({
    url: '/jd/order/' + id,
    method: 'get'
  })
}

// 新增mx订单
export function addOrder(data) {
  return request({
    url: '/jd/order',
    method: 'post',
    data: data
  })
}


// 修改mx订单
export function updateOrder(data) {
  return request({
    url: '/jd/order',
    method: 'put',
    data: data
  })
}

// 删除mx订单
export function delOrder(id) {
  return request({
    url: '/jd/order/' + id,
    method: 'delete'
  })
}

// 管理员界面添加订单
export function addAdminOrder(data) {
  return request({
    url: '/jd/order/addAdminOrder',
    method: 'post',
    data: data
  })
}
// 获取优惠券列表
export function getCouponList(data) {
  return request({
    url: '/jd/order/getCouponList',
    method: 'post',
    data: data
  })
}

/**
 * 改变返利状态
 * @param query
 * @returns {*}
 */
export function changeRebateStatus(query) {
  return request({
    url: '/jd/order/changAddRebate',
    method: 'post',
    data: query
  })
}

// 获取订单详细
export function getOrderDetail(id) {
  return request({
    url: '/jd/order/getOrderDetail/' + id,
    method: 'get'
  })
}

/**
 * 刷新今日抢购的cookie状态
 * @returns {*}
 */
export function refreshTodayCookieStatus() {
  return request({
    url: '/jd/order/refreshTodayCookieStatus' ,
    method: 'get'
  })
}
export function batchUpdate(data) {
  return request({
    url: '/jd/order/batchUpdate',
    method: 'post',
    data: data
  })
}

// 订单归历史
export function archiveOrder(query) {
  return request({
    url: '/jd/order/his/archive',
    method: 'post',
    data: query
  })
}

/**
 * 获取返利链接
 * @returns {*}
 */
export function getRebateUrl(data) {
  return request({
    url: '/jd/order/getRebateUrl' ,
    method: 'post',
    data:data
  })
}
